import React from 'react';
import { Radio, Checkbox } from 'antd';

class KnowledgeAccount extends React.Component {
  render() {
    const { title, data, accounts, changeAccount, getSelectBox, selectData } = this.props;
    return (
      <div>
        <Radio.Group onChange={changeAccount} value={accounts}>
          <Radio value={1}>全部{title}分类</Radio>
          <Radio value={2}>选定{title}分类</Radio>
        </Radio.Group>
        {
          accounts === 2 ? (
            <Checkbox.Group onChange={getSelectBox} value={selectData}>
              {
                data.map(item => {
                  return (
                    <div style={{ margin: '10px 0' }} key={item.value}>
                      <Checkbox value={item.value}>{item.name}</Checkbox>
                    </div>
                  )
                })
              }
            </Checkbox.Group>
          ) : null
        }
      </div>
    )
  }
}

export default KnowledgeAccount
